<%@ page pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title><fmt:message key='zbjssjkgl'/></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <form name="totalForm" id="totalForm" class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">

                <div class="layui-inline">
                    <label class="layui-form-label" style="width: 80px;"><fmt:message key='zjbid'/></label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="anchor.liveID" value="${params.anchor.liveID}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label" style="width: 80px;"><fmt:message key='zbjmc'/></label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="name" value="${params.name}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label" style="width: 80px;"><fmt:message key='fzrmc'/></label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="anchor.realName" value="${params.anchor.realName}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label" style="width: 80px;"><fmt:message key='fzrsjh'/></label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="anchor.mobile" value="${params.anchor.mobile}">
                    </div>
                </div>

                <div class="layui-inline">
                    <button class="layui-btn layui-btn-sm layuiadmin-btn-list" id="search"><i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> <fmt:message key='ss'/></button>
                </div>

            </div>
        </form>
    </div>
</div>

<div class="layui-card">
    <div class="layui-field-box layui-form">

        <table class="layui-table" lay-size="sm">
            <thead>
            <tr>
                <th width="5%"><input id="checkboxs" type="checkbox" lay-ignore lay-skin="primary"/></th>
                <th><fmt:message key='xh'/></th>
                <th><fmt:message key='zjbid'/></th>
                <th><fmt:message key='zbjmc'/></th>
                <th><fmt:message key='zbjtp'/></th>
                <th><fmt:message key='fzrmc'/></th>
                <th><fmt:message key='fzrsjh'/></th>
                <th><fmt:message key='kbsj'/></th>
                <th><fmt:message key='sfjx'/></th>
                <th><fmt:message key='cz'/></th>
            </tr>
            </thead>
            <c:forEach items="${page.result}" var="item" varStatus="status">
                <tr>
                    <td>
                        <input type="checkbox" lay-ignore value="${item.id}" class="feijin-check" lay-skin="primary"/>
                    </td>
                    <td>${status.index + 1}</td>
                    <td>${item.anchor.liveId}</td>
                    <td>${item.name}</td>
                    <td><img src="${store_domain}/uploads/${item.image}" class="preview" style="max-height: 150px"></td>
                    <td>${item.anchor.realName}</td>
                    <td>${item.anchor.mobile}</td>
                    <td><fmt:formatDate value="${item.beginTime}" type="both"/></td>
                    <td>
                        <c:if test="${item.choiceness}">
                            <a href="javascript:void(0);" data-id="${item.id}" class="layui-btn layui-btn-xs layui-btn-danger set-choiceness"><fmt:message key='qxjx'/></a>
                        </c:if>
                        <c:if test="${!item.choiceness}">
                            <a href="javascript:void(0);" data-id="${item.id}" class="layui-btn layui-btn-xs set-choiceness"><fmt:message key='szjx'/></a>
                        </c:if>
                            <%--                        <a href="javascript:void(0);" data-id="${item.id}" class="layui-btn layui-btn-xs detail">进入直播间</a>--%>
                        <a href="javascript:void(0);" data-id="${item.id}" class="layui-btn layui-btn-normal layui-btn-xs end"><fmt:message key='xx'/></a>
                    </td>
                </tr>
            </c:forEach>
        </table>
        <jsp:include page="/commons/page.jsp" flush="true"/>
    </div>
</div>

<script>
    layui.use("layer", function () {

        var layer = layui.layer;

        //直播间下线
        $(".end").click(function () {
            var id = $(this).attr("data-id");
            layer.confirm("<fmt:message key='qrxxm?'/>", function () {
                feijin.post({
                    url: "${web_domain}/live/session/end",
                    data: {"id": id}
                });
            });
        });

        //设为精选
        $(".set-choiceness").click(function() {
            var id = $(this).attr("data-id");
            layer.confirm("<fmt:message key='qrxxm?'/>", function () {
                feijin.post({
                    url: "${web_domain}/live/session/choiceness",
                    data: {"id": id}
                });
            });
        });

    });
</script>
</body>
</fmt:bundle>
</html>
